INCLUDES=-I../includes
OBJ=../obj
SRC=src
LIB=lib
DOC=doc
TEST=test

.PHONY: all build_static build_so build_dll clean default Makefile test

default: linked_queue.o

%.o: ${SRC}/%.c
	${CC} ${CPPFLAGS} ${CFLAGS} ${LDFLAGS} ${INCLUDES} -c $< -o $(OBJ)/$@

build_static: linked_queue.o

build_so: ${SRC}/linked_queue.c
	${CC} ${CPPFLAGS} ${CFLAGS} ${LDFLAGS} ${INCLUDES} -fPIC -c $< -o ${OBJ}/linked_queue.o

build_dll: ${SRC}/linked_queue.c
	$(CC) ${CPPFLAGS} ${CFLAGS} ${LDFLAGS} ${INCLUDES} -DBUILD_DLL -c $< -o ${OBJ}/linked_queue.o

test: ${TEST}/test_linked_queue.exe

${TEST}/test_linked_queue.exe: ${TEST}/test_linked_queue.c ${LIB}/linked_queue.o
	${CC} ${CPPFLAGS} ${CFLAGS} ${LDFLAGS} ${INCLUDES} $^ -o $@

clean:
	rm -f ${TEST}/*.o ${TEST}/*.exe ${TEST}/*.gch
